package cn.fu.tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

/**   
* @Title: IterationTagDemo.java 
* @Package cn.fu.tag 
* @Description: 重复执行
* @author zhangxiaofu   
* @Company www.viewhigh.com
* @date 2016年7月23日 下午11:13:32 
* @version V1.0   
*/
public class IterationTagDemo extends SimpleTagSupport{
private String [] items;
private String name;
public String[] getItems() {
	return items;
}
public void setItems(String[] items) {
	this.items = items;
}
public String getName() {
	return name;
}
public void setName(String name) {
	this.name = name;
}
@Override
	public void doTag() throws JspException, IOException {
		if(items != null && items.length >0){
			PageContext pageContext = (PageContext)getJspContext();
			for (int i = 0; i < items.length; i++) {
				pageContext.setAttribute(name, items[i]);
				//将内容写出到标签体
				getJspBody().invoke(null);
			}
		}
	}
}

